
<template>
  <elm-page-bb class="elm-tree-edit">
    <elm-page-tb :splite="false" :splite-show="false">
      <template #top>
        <right>
          <el-button-group>
            <elm-open-button url="pj_type_stage_edit" icon="el-icon-edit" title="新增" width="700" height="450" :data="{pid: '0',pj_type_id:postData.pj_type_id  }">新增</elm-open-button>
          </el-button-group>
        </right>
      </template>
      <elm-table-tree ref="table" url="/business/pmis/pj/type/stage/GetTree" :post-data="postData"  :default-expand-all="true" :page-size="9999" height="100%">
        <el-table-column type="index" label="序号" width="60px" align="center"></el-table-column>
        <el-table-column prop="name" label="名称" header-align="center">
        </el-table-column>
        <el-table-column prop="important" label="重要" align="center" width="50px">
          <template v-slot="scope">
            <span style="color: red">{{scope.row.important=="是"?"★":""}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="remark" label="备注" header-align="center"></el-table-column>
        <el-table-column prop="sort" label="顺序" width="80px" align="center"></el-table-column>
        <el-table-column fixed="right" label="操作" width="150px" align="center">
          <template v-slot="scope">
            <elm-open-button url="pj_type_stage_edit" :title="'编辑[' + scope.row.name + ']'" width="700" height="450" :data="{ model: scope.row }" type="text">编辑</elm-open-button>
            <elm-open-button url="pj_type_stage_edit" :title="'新增[' + scope.row.name + ']的下级'"  width="700" height="450"
                             :data="{  pid: scope.row.id,pj_type_id:postData.pj_type_id  }" type="text">新增下级</elm-open-button>
            <el-button @click="deleteData(scope.row)"  type="text" size="mini">删除</el-button>
          </template>
        </el-table-column>
      </elm-table-tree>
    </elm-page-tb>
    <template #bottom>
      <el-button size="small" @click="close">取消</el-button>
    </template>
  </elm-page-bb>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      postData:{pj_type_id:null}
    }
  },
  created() {
    this.postData.pj_type_id=this.request.id;
  },
  methods: {
    add(){

    },
    async deleteData(item) {
      await elm.post("/business/pmis/pj/type/stage/Delete", {id: item.id});
      this.treebinding();
    }
  }
}
</script>

